<script setup lang="ts">
import { provide, ref } from 'vue';
import ParentComp from './components/ParentComp.vue';


// 1. app组件数据传递给child
const count = ref(8848);

// 2. app组件函数传递给child，调用的时候可以回传数据
const updateCount = (num: number) => {
  count.value += num;
};

//把Count传递给后代
provide('count',count)

//把updateCount传递给后代
provide('updateCount',updateCount)

</script>

<template>
  <div class="app-page" style="border: 10px solid #ccc; padding: 50px; width: 600px">
    app 组件 {{ count }} updateCount
  <ParentComp/>
  </div>
</template>